/**
 * 作者: hxl
 * 日期: 2024-12-17 14:38:42
 * 备注: 推送礼包配置表
 */
package com.motu.monstercity.module.common.iap;
import com.motu.vertx.module.utility.toolset.Tool;
import io.vertx.core.json.JsonObject;

import java.util.ArrayList;
import java.util.List;

public class IapGiftPush extends IapGiftPushModel {

    // 推送礼包类型
    public static final int TYPE_STAGE = 1; // 通关副本
    public static final int TYPE_LEVEL = 2; // 玩家等级
    public static final int TYPE_ACT = 10; // 活动推送礼包

    private List<Integer> paramList = new ArrayList<>();
    private List<Integer> param2List = new ArrayList<>();
    private List<Integer> chargeNumList = new ArrayList<>();
    private List<Integer> subGiftList = new ArrayList<>();

    public IapGiftPush(JsonObject obj) {
        super(obj);
        if (!Tool.isEmpty(param)) {
            paramList = strToIntList(param, ";");
        }
        if (!Tool.isEmpty(param2)) {
            param2List = strToIntList(param2, ";");
        }
        if (!Tool.isEmpty(chargeNum)) {
            chargeNumList = strToIntList(chargeNum, ";");
        }
        if (!Tool.isEmpty(subIapGiftId)) {
            subGiftList = strToIntList(subIapGiftId, ";");
        }
    }

    private static List<Integer> strToIntList(String str, String delimiter) {
        List<Integer> list = new ArrayList<>();
        int[] array = Tool.strToIntArray(str, delimiter);
        for (int i = 0; i < array.length; i++) {
            list.add(array[i]);
        }
        return list;
    }

    public List<Integer> getParamList() {
        return paramList;
    }

    public List<Integer> getParam2List() {
        return param2List;
    }

    public List<Integer> getChargeNumList() {
        return chargeNumList;
    }
    public List<Integer> getSubGiftList() {
        return subGiftList;
    }
}
